import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:xiongan_app_yy/provider/store.dart';
import 'common/global.dart';
import 'routers/index.dart';

void main() {
  Global.init().then((e) {
    runApp(Store.init(
        //初始化Provider状态管理器
        child: MyApp()));
    if (Platform.isAndroid) {
      //状态栏透明
      SystemUiOverlayStyle style =
          SystemUiOverlayStyle(statusBarColor: Colors.transparent);
      SystemChrome.setSystemUIOverlayStyle(style);
    }
  });
}

class MyApp extends StatelessWidget {
//   This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        localizationsDelegates: [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
        ],
        supportedLocales: [
          const Locale('en', 'US'),
          const Locale('zh', 'CN'),
          //其它Locales
        ],
        locale: const Locale('zh',''),
        title: '雄安储检配',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
    textTheme: TextTheme(subhead: TextStyle(textBaseline: TextBaseline.alphabetic))
        ),

        initialRoute: "/",
        onGenerateRoute: (RouteSettings settings) {
          //初始化路由
          return Routers.init(settings: settings);
        });
  }
}
